package main;
import java.awt.Image;
import java.awt.Toolkit;

public class Cell {

    /**
     * holds an occupant, contains a reference to a larger grid
     */
    Grid grid1 = null; //the cell's host grid
    private Occupant occ1 = null; //the occupant that the cell contains
    String terrain = null; //describes the type of terrain that the cell represents
    Image occImage = Toolkit.getDefaultToolkit().getImage("character.gif");
    Image terrImage = Toolkit.getDefaultToolkit().getImage("grass.gif");
    //instead of images, perhaps use strings
    String occImg = null;
    String terrImg = "grass.gif";
    public Cell(Grid newGrid, String newTerrain)
    {
        grid1 = newGrid;
        terrain = newTerrain;
    }
    
    public void setGrid(Grid newGrid)
    {
        grid1 = newGrid;
    }//mutator method to set the grid
    
    public Grid getGrid()
    {
        return grid1;
    }//accessor method to get the grid
    
    public void addOccupant(Occupant newOcc)
    {
        occ1 = newOcc;
        occImg = occ1.getImage();
    }//sets occupant
    
    public void removeOccupant()
    {
        occ1 = null;
    }//removes occupant
    
    public Occupant getOccupant()
    {
        return occ1;
    }//returns occupant
    public String getOccImage(){
        return occImg;
    }//gets image of the occupant
    public String getTerrImage(){
    	return terrImg;
    }//gets image of the terrain
    public boolean hasOccupant(){
        if (occ1 == null)
            return false;
        else
            return true;
    }//returns whether or not the cell has an occupant
}